package com.apes.fico.finance.respository;


import com.apes.fico.finance.model.costcollect.WaterElectricityRent;
import com.apes.framework.jpa.repository.CustomRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.Date;
import java.util.List;
import java.util.Map;

public interface WaterElectricityRentRepository extends CustomRepository<WaterElectricityRent, String> {

    @Query(value = "select A.company_id,A.dept_id,A.year_month,A.type,sum(a.rent_amt) as rentAmt,sum(a.electricity_amt) as electricityAmt ,sum(A.water_amt) as waterAmt " +
            "from gl_Water_Electricity_Rent A where A.company_id = :company and A.dept_id = :dept and A.year_month = :yearMonth " +
            "and A.type = :type and a.valid = 1 group by A.company_id,A.dept_id,A.year_month,A.type" , nativeQuery = true)
    List<Map> findByCompanyDept(String company , String dept, Date yearMonth,String type);

}
